<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8" />
	<title>书店管理系统</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" type="text/css" href="/public/css/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="/public/css/swiper.min.css" />
	<link href="http://cdn.bootcss.com/animate.css/3.5.2/animate.min.css" rel="stylesheet" media="all">
	<link href="/public/css/bootstrap-touch-slider.css" rel="stylesheet" media="all">
	<link rel="stylesheet" type="text/css" href="/public/css/pc.css" />
	<link rel="stylesheet" type="text/css" media="screen and (max-width:1200px)" href="/public/css/ipad.css">
	<link rel="stylesheet" type="text/css" media="screen and (max-width:768px)" href="/public/css/phone.css">
	<script type="text/javascript" src="/public/js/jquery-1.11.1.min.js"></script>
	<script type="text/javascript" src="/public/js/bootstrap.min.js"></script>
	<script src="/public/js/common.js"></script>
	<script type="text/javascript" src="/public/js/swiper.min.js"></script>
	<script type="text/javascript" src="/public/js/scrollReveal.js"></script>
	<script src="http://cdn.bootcss.com/jquery.touchswipe/1.6.18/jquery.touchSwipe.min.js"></script>
	<script src="/public/js/bootstrap-touch-slider-min.js"></script>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=Diy1GpUowSnG4kyw93KWvG4GfQDm3xch"></script>

	<!-- 地区插件 -->
	<script src="/public/js/distpicker.data.js"></script>	
	<script src="/public/js/distpicker.js"></script>
	<script src="/public/js/main.js"></script>	

	<script type="text/javascript" src="/public/js/jquery.cookie.js"></script>
	<script type="text/javascript" src="/public/js/base64.js"></script>
	<script type="text/javascript" src="/public/js/xiuzhen.js"></script>
	<script>
		if ($(document.body).width() < 760) {
			// document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';
		} else {
			document.documentElement.style.fontSize = document.documentElement.clientWidth / 1 + 'px';
		}
	</script>
	<!--兼容ie8-->
	<!--[if lt IE 9]>
	    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
	    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
	
</head>

<body>
	<!-- 头部导航开始 -->
	<div class="header">
		<div class="nav">
			<img class="logo" src="/public/images/logo.png" alt="">
			<ul class="top">
				<li>
					<a href="index.html">首页</a>
				</li>
				<li>
					<a href="box.html">图书展示</a>
				</li>
				<li>
					<a href="labOne.html">图书资讯</a>
					
				</li>
				
				<li>
					<a href="about.html">关于我们</a>
				</li>
				<li>
					<a href="contact.html">联系我们</a>
				</li>
			</ul>
			<div class="right">
				<a href="login.html" class="login">会员登陆</a>
				
				<a class="indexCart" href="cart.html">
					<img class="cart" src="/public/images/cart.png" alt="">
				</a>
				<a class="leaguer" href="member.html" style="display: none;">
					<img class="" src="/public/images/people2.png" alt="">
				</a>
				<p id="username" style="display: none;"></p>
				<!-- <p class="line"></p>
				<img class="weixin" src="images/weixin.png" alt=""> -->
			</div>
		</div>
	</div>

	<!-- 子页面位置公共样式 -->
	<div class="com-position detail-position">
		<p class="container">
			<span>当前位置：</span>
			<a href="javascript:;">首页</a> >
			<a href="javascript:;">商品详情</a>
		</p>
	</div>

	<!-- 科学盒子详情 -->
	<div class="detail">
		<div class="container">
			<div  class="top">
				<div class="left" id="showbox">
					<!-- <img src="images/detail.png" width="550" height="440" alt="">
					<img src="images/maker14.png" width="550" height="440" alt="">
					<img src="images/maker13.png" width="550" height="440" alt="">
					<img src="images/maker22.png" width="550" height="440" alt="">
					<img src="images/maker22.png" width="550" height="440" alt=""> -->
				</div>
				<div class="right">
					<p class="name"></p>
					<p class="info"></p>
					<div class="showsum" id="showsum"></div>
					<div class="bottom" style="margin-top:20px;">
						<p class="price">
							<span>原价:</span>
							<span></span>	
							<span>现价:</span>
							<span></span>	
						</p>
						<div class="submit">
							<a href="javascript:;" class="buy">立即购买</a>
							<a href="javascript:;" class="vehicle">加入购物车</a>
						</div>
						
					</div> 
				</div>
			</div>
			<div class="center">
				<p class="title">
					<span>产品介绍</span>
				</p>
				<div class="goods">
					<div class="left">
						<div class="introduce">
							<!-- <img src="images/index71.png" alt="">
							<p>这里是对这个主题的介绍</p> -->
						</div>
						
					</div>
				</div>
				
		</div>
		
	</div>
	
	<!-- 预约弹框样式 -->
	<div class="appointShadow"></div>
	
	
	

	<!-- 右侧弹框 -->
	<div class="rightFrame">
		<div class="bespoke"><a href="saleApply.html">代售申请</a></div>
		<div class="placement"><img src="images/top.png" alt="">置顶</div>
	</div>


	<!-- 弹框样式 -->
	<div class="alert-box">
		<span class="xz-alert alert alert-danger"></span>
	</div>
	
	<!-- 公共底部开始 -->
	<div class="footer">
		<div class="footer-content1">
			<div></div>
		</div>
		<div class="footer-content">
			<div class="container">
				<div class="content">
					<div class="left">
						<img class="bottom-logo" src="/public/images/logo.png" alt="">
						<p class="des">此系统为不仅为人们提供了便利的购书平台，还在此基础上增加了代售和出租的功能，人们有想卖的书籍可以在此平台申请，平台会帮忙代售，还有的宝宝们，不想购买书籍，此平台提供了租书的功能，不需要购买就可以便宜看到自己想看的书籍啦！！！</p>
					</div>
					<div class="right">
						<div class="contact">
							<p class="title">联系我们</p>
							<p class="phone">电话：0755-23324516</p>
							<p class="email">邮箱：cd.01@oil-com.com</p>
							<p class="email">QQ：1056598469</p>
						</div>
					</div>
				</div>
				<p class="copy">地址：山西省太原市万柏林区下元街道公园时代城2号楼1301</p><br>
			</div>
		</div>	
		
	</div>

	<script type="text/javascript">
		

		var loginUrl = Base64.encode("detail.html");  
		$('.header .nav .right .login').attr('href','./login.html?loginurl='+loginUrl); 

		// 点击返回顶部
		$('.rightFrame .placement').on('click', function () {
			$("html,body").animate({
				scrollTop: 0
			}, 1000);
		});


		$(function(){
			var costPrice = 0;
			var optionValue = "";
			// 获取头部参数
			function parseUrl(url) {
				url = decodeURI(url)
				var splitURL = url.split('?')
				if (splitURL[0] == url) return {}
				var parmsStr = splitURL[1]
				var parms = parmsStr.split('&')
				var result = {}
				for (var i = 0; i < parms.length; i++) {
					var key = parms[i].split('=')[0]
					var value = Number(parms[i].split('=')[1]) || parms[i].split('=')[1]
					result[key] = value
				}
				return result
			}
			var commodityId =  parseUrl(window.location.href).commodityId;
			$.ajax({
				type: "get",
				dataType: "json", // submit info
				url: url + '/web/box/detail/' + commodityId,
				success: function (res) {
					if (!res.resultStatus) {
						$(".xz-alert").html(res.errorMessage);
						$('.xz-alert').show();
						setTimeout(function () {
							$(".xz-alert").hide();
						}, 2000);
						return
					}

					costPrice = res.resultData.nowPrice;

					$('.detail .top .right .name').html(''+ res.resultData.caption +'');   //标题的内容
					$('.detail .top .right .info').html(''+ res.resultData.content +'');   //描述的内容
					$('.detail .center .goods .introduce').html(''+ res.resultData.detail +'');   //盒子的描述
					$('.detail .center .bottom .price span:nth-child(2)').html(''+ res.resultData.originalPrice +'元');   //原价
					$('.detail .center .bottom .price span:nth-child(4)').html(''+ res.resultData.nowPrice +'元');   //现价
					$('.detail .top .bottom .price span:nth-child(2)').html(''+ res.resultData.originalPrice +'元');   //原价
					$('.detail .top .bottom .price span:nth-child(4)').html(''+ res.resultData.nowPrice +'元');   //现价
					$('.detail .top .bottom label:first-child span:nth-child(1)').html(''+ res.resultData.nowPrice +'元');   //套餐
			
			
					// 这是商品的小图片
					var commodityIcon = "";  
					var commodityIconList = res.resultData.hasPicture.split(";");
					for (var i = 0; i < commodityIconList.length; i++) { 
						commodityIcon += '<img src="'+ commodityIconList[i] +'" width="550" height="440" alt="">' 
					}
					$("#showbox").html(commodityIcon);

					var showproduct = {
						"boxid":"showbox",
						"sumid":"showsum",
						"boxw":550,//宽度,该版本中请把宽高填写成一样
						"boxh":440,//高度,该版本中请把宽高填写成一样
						"sumw":90,//列表每个宽度,该版本中请把宽高填写成一样
						"sumh":90,//列表每个高度,该版本中请把宽高填写成一样
						"sumi":28,//列表间隔
						"sums":5,//列表显示个数
						"sumsel":"sel",
						"sumborder":1,//列表边框，没有边框填写0，边框在css中修改
						};//参数定义	  
					$.ljsGlasses.pcGlasses(showproduct);//方法调用，务必在加载完后执行
					// $("#showsum p").css("left","0px !important")
					$("#showsum p").offset.left = 0;	
				},	
				error: function (e) {
					$(".xz-alert").html("请求书籍失败");
					$('.xz-alert').show();
					setTimeout(function () {
						$(".xz-alert").hide();
					}, 2000);
				}
		
			})
			

			//点击加入购物车
			var choice = 0;
			var price = 0;
			var skiuValue = [];
			$(".detail .vehicle").click(function(){
				skiuValue = [];
				if(!$.cookie('uid')){
					location.href = './login.html';
				}else{	
					submit();
					
				}
			})

			// 添加购物车提交数据
			function submit(){
				$.ajax({
					type: "post",
					dataType: "json", // submit info
					url: url + '/v1/front/mall/cart',
					data:{
						cartId:0,
						commodityId:commodityId,
						amounts:1,
						userId:$.cookie('uid'),
						price:price,
					},
					contentType:"application/x-www-form-urlencoded",
					success: function (res) {
						if (!res.resultStatus) {
							$(".xz-alert").html(res.errorMessage);
							$('.xz-alert').show();
							setTimeout(function () {
								$(".xz-alert").hide();
							}, 1000);
							return
						}
						$(".xz-alert").html("加入购物车成功！");
						$('.xz-alert').show();
						setTimeout(function () {
							$(".xz-alert").hide();
							// location.href = './cart.html';
						}, 3000);

						
					},
					error: function (e) {
						$(".xz-alert").html("提交数据失败");
						$('.xz-alert').show();
						setTimeout(function () {
							$(".xz-alert").hide();
						}, 1000);
					}
			
				})	
			}

		

			// 点击立即购买
			$(".detail .buy").click(function(){
				if(!$.cookie('uid')){
					location.href = './login.html';
				}else{
					location.href = './confirm.html?commodityId='+commodityId ;
				}
			})
				
				
			// 验证手机号
			function isPhoneNo(phone) {
				var pattern = /^1[34578]\d{9}$/;
				return pattern.test(phone);
			}
			
		})
		

		
	</script>		

</body>

</html>